import axios,{ url } from './index';
// 查看所有商品
export const getAll = async (data) => {
    console.log(data,'后端');
    let res = await axios({
        method:"get",
        url:url + "/shops/",
        params:data
    });
    // console.log(res.data);
    return res.data;
}
// 增加
export const addShops = async (data) => {
    console.log(data);
    let res = await axios({
        method:"post",
        url:url + "/shops/",
        data
    });
    // console.log(res,'avx');
    return res.data;
}

// // 修改 表格里的id
export const findById = async (id) => {
    // console.log(data);
    let res = await axios({
        method:"get",
        url:url + "/shops/"+id,
       
    });
    return res.data;
}
// 修改 
export const putShops = async (data) => {
    // console.log(data);
    let res = await axios({
        method:"put",
        url:url + "/shops/"+data._id,
        data
    });
    return res.data;
}
// //删除
export const delShops = async (id) => {
    // console.log(data);
    let res = await axios({
        method:"delete",
        url:url + "/shops/"+id,
        // params:data
    });
    return res.data;
}
// 上传商品
export const addUpload = async (data) => {
    console.log(data,'111'); //得到选中的图片
    let res = await axios({
        method:"post",
        url:url + "/upload",
        data
    });
    return res.data;
}